#-*- coding=utf-8 -*-
class TickData:
    def __init__(self, HighestPrice=0, BidPrice5=0, BidPrice4=0, BidPrice3=0, BidPrice2=0, BidPrice1=0, LowerLimitPrice=0, OpenPrice=0, AskPrice5=0, AskPrice4=0, AskPrice3=0, AskPrice2=0, AskPrice1=0, PreClosePrice=0, PreSettlementPrice=0, UpdateTime="", UpdateMillisec=0, AveragePrice=0, BidVolume5=0, BidVolume4=0, BidVolume3=0, BidVolume2=0, BidVolume1=0, PreOpenInterest=0, Volume=0, AskVolume5=0, AskVolume4=0, AskVolume3=0, AskVolume2=0, AskVolume1=0, UpperLimitPrice=0, InstrumentID="", ClosePrice=0, ExchangeID="", TradingDay="", PreDelta=0, OpenInterest=0, CurrDelta=0, Turnover=0, LastPrice=0, SettlementPrice=0, ExchangeInstID="", LowestPrice=0, ftime=0):
        self.HighestPrice=HighestPrice
        self.BidPrice5=BidPrice5
        self.BidPrice4=BidPrice4
        self.BidPrice3=BidPrice3
        self.BidPrice2=BidPrice2
        self.BidPrice1=BidPrice1
        self.LowerLimitPrice=LowerLimitPrice
        self.OpenPrice=OpenPrice
        self.AskPrice5=AskPrice5
        self.AskPrice4=AskPrice4
        self.AskPrice3=AskPrice3
        self.AskPrice2=AskPrice2
        self.AskPrice1=AskPrice1
        self.PreClosePrice=PreClosePrice
        self.PreSettlementPrice=PreSettlementPrice
        self.UpdateTime=UpdateTime
        self.UpdateMillisec=UpdateMillisec
        self.AveragePrice=AveragePrice
        self.BidVolume5=BidVolume5
        self.BidVolume4=BidVolume4
        self.BidVolume3=BidVolume3
        self.BidVolume2=BidVolume2
        self.BidVolume1=BidVolume1
        self.PreOpenInterest=PreOpenInterest
        self.Volume=Volume
        self.AskVolume5=AskVolume5
        self.AskVolume4=AskVolume4
        self.AskVolume3=AskVolume3
        self.AskVolume2=AskVolume2
        self.AskVolume1=AskVolume1
        self.UpperLimitPrice=UpperLimitPrice
        self.InstrumentID=InstrumentID
        self.ClosePrice=ClosePrice
        self.ExchangeID=ExchangeID
        self.TradingDay=TradingDay
        self.PreDelta=PreDelta
        self.OpenInterest=OpenInterest
        self.CurrDelta=CurrDelta
        self.Turnover=Turnover
        self.LastPrice=LastPrice
        self.SettlementPrice=SettlementPrice
        self.ExchangeInstID=ExchangeInstID
        self.LowestPrice=LowestPrice
        self.ftime=ftime
        self.vcmap={}
    def __repr__(self): return "<%s>" % ",".join(["%s:%s" % (x, getattr(self, x)) for x in ['HighestPrice', 'BidPrice5', 'BidPrice4', 'BidPrice1', 'BidPrice3', 'BidPrice2', 'LowerLimitPrice', 'OpenPrice', 'AskPrice5', 'AskPrice4', 'AskPrice3', 'PreClosePrice', 'AskPrice1', 'PreSettlementPrice', 'AskVolume1', 'UpdateTime', 'UpdateMillisec', 'AveragePrice', 'BidVolume5', 'BidVolume4', 'BidVolume3', 'BidVolume2', 'PreOpenInterest', 'AskPrice2', 'Volume', 'AskVolume3', 'AskVolume2', 'AskVolume5', 'AskVolume4', 'UpperLimitPrice', 'BidVolume1', 'InstrumentID', 'ClosePrice', 'ExchangeID', 'TradingDay', 'PreDelta', 'OpenInterest', 'CurrDelta', 'Turnover', 'LastPrice', 'SettlementPrice', 'ExchangeInstID', 'LowestPrice', 'ftime']])
    def __str__(self):  return "<%s>" % ",".join(["%s:%s" % (y, self.getval(x)) for x,y in [('HighestPrice', u'HighestPrice'),('BidPrice5', u'BidPrice5'),('BidPrice4', u'BidPrice4'),('BidPrice1', u'BidPrice1'),('BidPrice3', u'BidPrice3'),('BidPrice2', u'BidPrice2'),('LowerLimitPrice', u'LowerLimitPrice'),('OpenPrice', u'OpenPrice'),('AskPrice5', u'AskPrice5'),('AskPrice4', u'AskPrice4'),('AskPrice3', u'AskPrice3'),('PreClosePrice', u'PreClosePrice'),('AskPrice1', u'AskPrice1'),('PreSettlementPrice', u'PreSettlementPrice'),('AskVolume1', u'AskVolume1'),('UpdateTime', u'UpdateTime'),('UpdateMillisec', u'UpdateMillisec'),('AveragePrice', u'AveragePrice'),('BidVolume5', u'BidVolume5'),('BidVolume4', u'BidVolume4'),('BidVolume3', u'BidVolume3'),('BidVolume2', u'BidVolume2'),('PreOpenInterest', u'PreOpenInterest'),('AskPrice2', u'AskPrice2'),('Volume', u'Volume'),('AskVolume3', u'AskVolume3'),('AskVolume2', u'AskVolume2'),('AskVolume5', u'AskVolume5'),('AskVolume4', u'AskVolume4'),('UpperLimitPrice', u'UpperLimitPrice'),('BidVolume1', u'BidVolume1'),('InstrumentID', u'InstrumentID'),('ClosePrice', u'ClosePrice'),('ExchangeID', u'ExchangeID'),('TradingDay', u'TradingDay'),('PreDelta', u'PreDelta'),('OpenInterest', u'OpenInterest'),('CurrDelta', u'CurrDelta'),('Turnover', u'Turnover'),('LastPrice', u'LastPrice'),('SettlementPrice', u'SettlementPrice'),('ExchangeInstID', u'ExchangeInstID'),('LowestPrice', u'LowestPrice'), ('ftime', u'ftime')]])
    def getval(self, n):
        if n in []:
            return self.vcmap[n][getattr(self, n)[1:-1]].encode("utf-8")
        else: return getattr(self, n)
